Tobias adds hdop, vdop, pdop, satellites, fix, speed and course for
authorrobertl <robertl@f51c46e8-681c-474f-0cfe-069cfd0219fb>
Tue, 19 Jul 2005 00:00:52 +0000 (00:00 +0000)
committerrobertl <robertl@f51c46e8-681c-474f-0cfe-069cfd0219fb>
Tue, 19 Jul 2005 00:00:52 +0000 (00:00 +0000)
xcsv.  Adds gpsdrivetrack and openoffice formats.

gpsbabel/csv_util.c
gpsbabel/style/README.style
gpsbabel/style/gpsdrivetrack.style [new file with mode: 0644]
gpsbabel/style/openoffice.style [new file with mode: 0644]

index 94c5d39173eb9cd12d0af2c7af4598df2df49959..e1c15602c1baa3fad6a7094f4c981f96f7f6857a 100644 (file)
@@ -832,6 +832,14 @@ xcsv_parse_val(const char *s, waypoint *wpt, const field_map_t *fmp)
        /* altitude in meters as a decimal value */
        wpt->altitude = atof(s);
     } else
+    
+    /* PATH CONVERSIONS ************************************************/
+    if (strcmp(fmp->key, "PATH_SPEED") == 0) {
+       wpt->speed = atof(s);
+    } else
+    if (strcmp(fmp->key, "PATH_COURSE") == 0) {
+       wpt->course = atof(s);
+    } else
 
     /* TIME CONVERSIONS ***************************************************/
     if (strcmp(fmp->key, "EXCEL_TIME") == 0) {
@@ -887,6 +895,33 @@ xcsv_parse_val(const char *s, waypoint *wpt, const field_map_t *fmp)
        wpt->gc_data.placer = csv_stringtrim(s, "", 0);
     } else
        
+    /* GPS STUFF *******************************************************/
+    if (strcmp(fmp->key, "GPS_HDOP") == 0) {
+        wpt->hdop = atof(s);
+    } else
+    if (strcmp(fmp->key, "GPS_VDOP") == 0) {
+       wpt->vdop = atof(s);
+    } else
+    if (strcmp(fmp->key, "GPS_PDOP") == 0) {
+        wpt->pdop = atof(s);
+    } else
+    if (strcmp(fmp->key, "GPS_SAT") == 0) {
+       wpt->sat = atoi(s);
+    } else
+    if (strcmp(fmp->key, "GPS_FIX") == 0) {
+       wpt->fix = atoi(s)-1;
+       if ( wpt->fix < fix_2d) {
+       if (!strcasecmp(s, "none"))
+               wpt->fix = fix_none;
+       else if (!strcasecmp(s, "dgps"))
+               wpt->fix = fix_dgps;
+       else if (!strcasecmp(s, "pps"))
+               wpt->fix = fix_pps;
+       else
+               wpt->fix = fix_unknown;
+       }
+    } else
+       
     /* OTHER STUFF ***************************************************/
     if ( strcmp( fmp->key, "PATH_DISTANCE_MILES") == 0) {
        /* Ignored on input */
@@ -1218,6 +1253,12 @@ xcsv_waypt_pr(const waypoint *wpt)
             /* path (route/track) distance in  */
             writebuff( buff, fmp->printfc, pathdist * 5280*12*2.54/100/1000 );
        } else
+       if (strcmp(fmp->key, "PATH_SPEED") == 0) {
+            writebuff( buff, fmp->printfc, wpt->speed );
+       } else
+       if (strcmp(fmp->key, "PATH_COURSE") == 0) {
+            writebuff( buff, fmp->printfc, wpt->course );
+       } else
 
         /* TIME CONVERSIONS**************************************************/
         if (strcmp(fmp->key, "EXCEL_TIME") == 0) {
@@ -1272,9 +1313,50 @@ xcsv_waypt_pr(const waypoint *wpt)
         } else 
        if (strcmp(fmp->key, "GEOCACHE_PLACER") == 0) {
            writebuff(buff, fmp->printfc, NONULL(wpt->gc_data.placer));
-        } else {
-           /* this should probably never happen */
+        } else
+       
+       /* GPS STUFF *******************************************************/
+       if (strcmp(fmp->key, "GPS_HDOP") == 0) {
+            writebuff(buff, fmp->printfc, wpt->hdop);
+        } else
+       if (strcmp(fmp->key, "GPS_VDOP") == 0) {
+            writebuff(buff, fmp->printfc, wpt->vdop);
+        } else
+       if (strcmp(fmp->key, "GPS_PDOP") == 0) {
+            writebuff(buff, fmp->printfc, wpt->pdop);
+        } else
+       if (strcmp(fmp->key, "GPS_SAT") == 0) {
+            writebuff(buff, fmp->printfc, wpt->sat);
+        } else
+       if (strcmp(fmp->key, "GPS_FIX") == 0) {
+               char *fix = NULL;
+               switch (wpt->fix) {
+                       case fix_unknown:
+                               fix = "Unknown";
+                               break;
+                       case fix_none:
+                               fix = "None";
+                               break;
+                       case fix_2d:
+                               fix = "2d";
+                               break;
+                       case fix_3d:
+                               fix = "3d";
+                               break;
+                       case fix_dgps:
+                               fix = "dgps";
+                               break;
+                       case fix_pps:
+                               fix = "pps";
+                               break;
+               }
+               writebuff(buff, fmp->printfc, fix);
+        } else
+
+       {
+               /* this should probably never happen */
         }
+       
 
         obuff = csv_stringclean(buff, xcsv_file.badchars);
         fprintf (xcsv_file.xcsvfp, "%s", obuff);
index db4d3f44794d73e5310d731e6c4f50b77ffbd271..b191b9bd1a1bfb1235d58539fb33f9e111e58b6b 100644 (file)
@@ -449,6 +449,34 @@ The fields used by the XCSV parser are as follows:
    PATH_DISTANCE_KM is like PATH_DISTANCE_MILES except it outputs the 
    length in kilometers.  
 
+ o PATH_SPEED
+   Speed in meters per second. Gpsbabel does NOT calculate this data, it is
+   read from the input file if present.
+
+   example: PATH_SPEED,"","%f"
+
+ o PATH_COURSE
+   Course in degerees.  Gpsbabel does NOT calculate this data, it is
+   read from the input file if present.
+
+   example: PATH_COURSE,"","%f"
+
+ o GPS_HDOP, GPS_VDOP, GPS_PDOP
+   GPS distorsion of position parameters. Needs float conversion.
+
+   example: GPS_HDOP,"","%f"
+
+ o GPS_SAT
+   Number of satellites used for determination of the position. Needs
+   interger conversion.
+
+   example: GPS_SAT,"","%d"
+
+ o GPS_FIX
+   Type of fix (see GPX spec). Needs string conversion.
+
+   example: GPS_FIX,"","%s"
+
 EXAMPLES:
 --------
 For examples on using the XCSV module, please see the *.style files in
diff --git a/gpsbabel/style/gpsdrivetrack.style b/gpsbabel/style/gpsdrivetrack.style
new file mode 100644 (file)
index 0000000..e7a47ff
--- /dev/null
@@ -0,0 +1,27 @@
+# gpsbabel XCSV style file
+#
+# Format: GPSDriveTrack
+# Author: Tobias Minich
+#   Date: 12/07/2005
+#
+# 
+#
+
+DESCRIPTION            GpsDrive Format for Tracks
+
+# FILE LAYOUT DEFINITIIONS:
+#
+FIELD_DELIMITER                WHITESPACE
+RECORD_DELIMITER       NEWLINE
+BADCHARS               ,'"
+
+SHORTLEN               20
+SHORTWHITE              0
+
+#
+# INDIVIDUAL DATA FIELDS, IN ORDER OF APPEARANCE:
+
+OFIELD LAT_DECIMAL, "", "%10.6f"
+OFIELD LON_DECIMAL, "", "%10.6f"
+OFIELD ALT_METERS, "", "%10.0f"
+OFIELD GMT_TIME, "", "%a %b %d %T %Y"
diff --git a/gpsbabel/style/openoffice.style b/gpsbabel/style/openoffice.style
new file mode 100644 (file)
index 0000000..b39a179
--- /dev/null
@@ -0,0 +1,48 @@
+# gpsbabel XCSV style file
+#
+# Format: Tab delimitered csv useful for OpenOffice, Ploticus etc.
+# Author: Tobias Minich
+#   Date: 07/18/2005
+#
+#
+
+DESCRIPTION            Custom "Everything" Style
+
+# FILE LAYOUT DEFINITIIONS:
+#
+FIELD_DELIMITER                TAB
+RECORD_DELIMITER       NEWLINE
+BADCHARS               TAB
+FORMAT_TYPE            INTERNAL
+
+#
+# HEADER STUFF:
+#
+PROLOGUE       Index   Lat                     Lon                     Icon    Name    Description     Notes   URL     Link Text       Altitude (m)    Distance (km)   Speed (m/s)     Course (°)      Time    HDOP    VDOP    PDOP    Satellites      Fix
+
+#
+# INDIVIDUAL DATA FIELDS:
+#
+IFIELD INDEX, "", "%d"
+IFIELD LAT_DECIMAL, "", "%f"
+IFIELD LAT_DIR, "", "%c"
+IFIELD LAT_HUMAN_READABLE, "", "%d° %f' %c"
+IFIELD LON_DECIMAL, "", "%f"
+IFIELD LON_DIR, "", "%c"
+IFIELD LON_HUMAN_READABLE, "", "%d° %f' %c"
+IFIELD ICON_DESCR, "", "%s"
+IFIELD SHORTNAME, "", "%s"
+IFIELD DESCRIPTION, "", "%s"
+IFIELD NOTES, "", "%s"
+IFIELD URL, "", "%s"           
+IFIELD URL_LINK_TEXT, "", "%s"
+IFIELD ALT_METERS, "", "%f"
+IFIELD PATH_DISTANCE_KM, "", "%f"
+IFIELD PATH_SPEED, "", "%f"
+IFIELD PATH_COURSE, "", "%f"
+IFIELD EXCEL_TIME, "", "%f"
+IFIELD GPS_HDOP, "", "%f"
+IFIELD GPS_VDOP, "", "%f"
+IFIELD GPS_PDOP, "", "%f"
+IFIELD GPS_SAT, "", "%d"
+IFIELD GPS_FIX, "", "%s"